package com.examples.sorting;

public class BubbleSort {
	public static void bubbleSort(int[] matrix) {
		
		for(int i = 0; i < matrix.length; i++) 
			for(int j = i+1 ; j < matrix.length;j++)
					if(matrix[i]>matrix[j])
					{
						int temp = matrix[i];
						matrix[i] = matrix[j];
						matrix[j] = temp;
					}
	}
	public static void main(String[] args) {
		
		// Bubble Sort

				int[] matBS = GeneratePrintArray.generateRandomArray(10);

				System.out.print("\n\nBubble Sort \t");
				GeneratePrintArray.printArray(matBS);
				bubbleSort(matBS);
				
				System.out.print("\nBubble Sorted   ");
				GeneratePrintArray.printArray(matBS);
	}
}
